<?php
class TbfReflect {
    private static $meta_class_map = array();
    /**
     * @param string $class_name
     * @return \ReflectionClass
     */
    public static function getReflectionClass($class_name){
        if (!empty(self::$meta_class_map[$class_name])){
            return self::$meta_class_map[$class_name];
        }
        self::$meta_class_map[$class_name] = new \ReflectionClass($class_name);
        return self::$meta_class_map[$class_name];
    }

    /**
     * @param $obj
     * @return \ReflectionClass
     */
    public static function getReflectionClassFromObject($obj){
        return self::getReflectionClass(get_class($obj));
    }
} 